package epay18

import (
	"github.com/zeromicro/go-zero/rest/httpx"
	"navi-mumbai/common/httpresult"
	"net/http"

	"navi-mumbai/app/api/pay/internal/logic/epay18"
	"navi-mumbai/app/api/pay/internal/svc"
	"navi-mumbai/app/api/pay/internal/types"
)

func AutoDepositNotifyEpay18Handler(svcCtx *svc.ServiceContext) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		var req types.DepositNotifyEpay18ReqContent
		if err := httpx.Parse(r, &req); err != nil {
			httpresult.ParamErrorResult(r, w, err)
			return
		}
		l := epay18.NewAutoDepositNotifyEpay18Logic(r.Context(), svcCtx)
		_, err := l.AutoDepositNotifyEpay18(&req)

		w.WriteHeader(http.StatusOK)
		if err != nil {
			w.Write([]byte(err.Error()))
		} else {
			w.Write([]byte("SUCCESS"))
		}
	}
}
